<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
</head>

<body>
	<script>
		/* axios.get('http://www.liulongbin.top:3006/api/getbooks').then(res => {
			console.log(res, 8888);
		}) */
		// axios('http://www.liulongbin.top:3006/api/getbooks').then(res => {
		// 	console.log(res, 8888);
		// })

		// axios('http://www.liulongbin.top:3006/api/getbooks',{
		// 	params:{
		// 		id:2
		// 	}
		// }).then(res => {
		// 	console.log(res, 8888);
		// })


		axios.defaults.baseURL='http://www.liulongbin.top:3006/api'

		axios({
			url: '/getbooks',
			method: 'get',
			params: {
				id: 2
			}
		}).then(res => {
			console.log(res, 9999);
		})
		/* 只要是axios  get请求问好传参     就必须写到params中 

		pst请求是没有params的   他的参数是写在data中

		axios({
			method: 'post',
			url: '/user/12345',
			data: {
				firstName: 'Fred',
				lastName: 'Flintstone'
			}
		});

		axios({
			method: 'get',
			url: '/user/12345',
			params: {
				firstName: 'Fred',
				lastName: 'Flintstone'
			}
		});
		*/

		// axios({
		// 	url: 'http://www.liulongbin.top:3006/api/getbooks',
		// 	method: 'post',
		// 	data: {
		// 		id: 2
		// 	}
		// }).then(res => {
		// 	console.log(res, 9999);
		// })
	</script>
</body>

</html>
